#!/bin/bash

# 检查imap和pop3-server是否已安装
if rpm -q dovecot >/dev/null 2>&1 || rpm -q cyrus-imapd >/dev/null 2>&1; then
    echo "[-] 不符合要求：检测到imap或pop3-server已安装"
    
    # 显示已安装的相关包
    echo "    已安装的邮件服务器包:"
    if rpm -q dovecot >/dev/null 2>&1; then
        echo "    - dovecot ($(rpm -q dovecot))"
    fi
    if rpm -q cyrus-imapd >/dev/null 2>&1; then
        echo "    - cyrus-imapd ($(rpm -q cyrus-imapd))"
    fi
    
    # 检查服务状态
    if systemctl is-active dovecot >/dev/null 2>&1; then
        echo "    dovecot服务正在运行"
    fi
    if systemctl is-active cyrus-imapd >/dev/null 2>&1; then
        echo "    cyrus-imapd服务正在运行"
    fi
    
    exit 1
else
    echo "[+] 符合要求：未检测到imap或pop3-server安装"
    exit 0
fi

